# this version of getCSPPattern filters certain strategies for
# further evaluations (stoplimits, performance,...)

getCSPPattern200 <- function(TS, from="1992", to=NULL) {
  if (!is.xts(TS)) {
    stop("TS argument supplied to getCSPPattern is not a xts object")
  }
  ASSIG <- ADXStatus(TS, addSig=TRUE)
  SMA50 <- SMAStatus(TS, n=50)
  SMA200 <- SMAStatus(TS, n=200)
  GAP <- CSPStatus(TS, "GAP")
  DC <- DCStatus(TS, 10)
  
  S_ADX_1060 <- ASSIG[,'ADXgt25'] & ASSIG[,'sig_DIcu'] & SMA200[,'CltSMA200']
  colnames (S_ADX_1060) <- c('S_ADX_1060')
  S_ADX_4290 <- ASSIG[,'ADXnt'] & ASSIG[,'sig_DIcd'] & ASSIG[,'sig_ADXrise'] & SMA50[,'CltSMA50']
  colnames (S_ADX_4290) <- c('S_ADX_4290')
  S_GAP_9228 <- ASSIG[,'ADXgt25'] & ASSIG[,'DIpgt'] & SMA50[,'CltSMA50'] & GAP[,'GapUp']
  colnames (S_GAP_9228) <- c('S_GAP_9228')
  L_DONCHIAN_17428 <- ASSIG[,'ADXgt25'] & ASSIG[,'DIngt'] & SMA50[,'CltSMA50'] & DC[,'CltDC10']
  colnames (L_DONCHIAN_17428) <- c('L_DONCHIAN_17428')
  
  if (is.null(to)) {
    subsetstring = paste(from, "/", sep="")
  } else {
    subsetstring = paste(from, to, sep="/")
  }
  
  result <- cbind(
    S_ADX_1060,
    S_ADX_4290,
    S_GAP_9228,
    L_DONCHIAN_17428
    )
  return (result[subsetstring])
}
